//
//  BSNewViewController.m
//  BaiSi
//
//  Created by Sycamore on 16/4/27.
//  Copyright © 2016年 Sycamore. All rights reserved.
//

#import "BSNewViewController.h"
#import "BSTagViewController.h"
#import "BSAllViewController.h"
#import "BSTextViewController.h"
#import "BSVideoViewController.h"
#import "BSVoiceViewController.h"
#import "BSPictureViewController.h"


@interface BSNewViewController ()

@end

@implementation BSNewViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    //设置导航条内容
    [self setupNavigation];
    
    
    //添加子控制器
    [self addAllChildControllers];
    

}

//设置导航条内容
- (void)setupNavigation
{
    UIImageView *imageView = [[UIImageView alloc]init];
    imageView.image = [UIImage imageNamed:@"MainTitle"];
    [imageView sizeToFit];
    self.navigationItem.titleView = imageView;
    
    self.navigationItem.rightBarButtonItem = [UIBarButtonItem itemWithImage:[UIImage imageNamed:@"navigationButtonRandom"] highlightedImage:[UIImage imageNamed:@"navigationButtonRandomClick"] target:self action:@selector(rightButtonClick)];
    
    self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithImage:[UIImage imageNamed:@"MainTagSubIcon"] highlightedImage:[UIImage imageNamed:@"MainTagSubIconClick"] target:self action:@selector(tagButtonClick)];
}

//#warning TODO:
- (void)tagButtonClick
{
    BSTagViewController *tagVC = [[BSTagViewController alloc]init];
    
    [self.navigationController pushViewController:tagVC animated:YES];
}

- (void)rightButtonClick
{
    BSFunction;
}


//创建所有的子控制器
- (void)addAllChildControllers
{
    //全部
    BSAllViewController *all = [[BSAllViewController alloc]init];
    all.title = @"全部";
    [self addChildViewController:all];
    
    //视频
    BSVideoViewController *video = [[BSVideoViewController alloc]init];
    video.title = @"视频";
    [self addChildViewController:video];
    
    //声音
    BSVoiceViewController *voice = [[BSVoiceViewController alloc]init];
    voice.title = @"声音";
    [self addChildViewController:voice];
    
    //图片
    BSPictureViewController *picture = [[BSPictureViewController alloc]init];
    picture.title = @"图片";
    [self addChildViewController:picture];
    
    //段子
    BSTextViewController *text = [[BSTextViewController alloc]init];
    text.title = @"段子";
    [self addChildViewController:text];
    
}




@end
